<?php
/**
 * @author Feng
 * @date 2012-6-15
 */
class resource_keyword_row extends system_concept_row {

	public function setName($name) {
		if(!$name) {
			$this->set('name', '');
		} else {
			$name = preg_replace('#[\\\\\\\/\?\|\#\;\,]+#u', '', $name);
			$name = preg_replace('#[\s]+#u', ' ', $name);
			$this->set('name', trim($name));
		}
		return $this;
	}
	
	public function updatePSCount() {
		$concept = new picture_photo_keyword_concept();
		$this->setPtotal($concept->fetchCount(array('keyword_id = ?' => $this->getId())));

		$concept = new picture_special_keyword_concept();
		$this->setStotal($concept->fetchCount(array('keyword_id = ?' => $this->getId())));
		$this->update();
	}
	
}
